
const cc = `
http://push2.eastmoney.com/api/qt/stock/get?invt=2&fltt=1&cb=jQuery351011495935578379779_1729932685143&fields=f408%2Cf410%2Cf481%2Cf411%2Cf59%2Cf409%2Cf414%2Cf154%2Cf412%2Cf152%2Cf415%2Cf416%2Cf417%2Cf418&secid=12.90004178&ut=fa5fd1943c7b386f172d6893dbfba10b&wbp2u=%7C0%7C0%7C0%7Cweb&dect=1&_=1729932685144`
export const TABLE_CONFIG = {

    f1
        :
        4,
    currentPrice
        :
        'f2',
    currentPrice_put
        :
        'f341',
    call_zdf
        :
        'f3',
    put_zdf
        :
        'f343',
    call_zdprice
        :
        'f4',
    put_zdprice
        :
        'f342',
    call_cjl
        :
        'f5',
    put_cjl
        :
        'f344',
    call_id
        :
        'f12',
    put_id
        :
        'f339',
    f13
        :
        12,
    call_name
        :
        'f14',
    put_name
        :
        'f340',
    /** 持仓量 */
    call_ccl
        :
        'f108',
    put_ccl
        : 'f344',
    f152
        :
        2,
    f161
        :
        4.6,
    /** 隐含波动率 */
    call_yhbdl
        :
        'f249',
    put_yhbdl
        :
        'f346',
    f250
        :
        -0.56,
    f330
        :
        3,
    f334
        :
        6.13,



}


export const fomartListItemlData = (list, type) => {
    const temlist = list?.map(record => {
        let tem = { ...record }
        if (type === 'put') {
            tem = {
                ...record,
                id: record?.[TABLE_CONFIG?.put_id],
                currentPrice: Number((record?.[TABLE_CONFIG?.currentPrice_put] * 10000).toFixed()),
                zdprice: (record?.[TABLE_CONFIG?.put_zdprice] * 10000).toFixed(),
                ccl: record?.[TABLE_CONFIG?.put_ccl],
                name: record?.[TABLE_CONFIG?.put_name],
                zdf: record?.[TABLE_CONFIG?.put_zdf],
                cjl: record?.[TABLE_CONFIG?.put_cjl],
                yhbdl: record?.[TABLE_CONFIG?.put_yhbdl],
            }
        } else {
            tem = {
                ...record,
                id: record?.[TABLE_CONFIG?.call_id],
                currentPrice: Number((record?.[TABLE_CONFIG?.currentPrice] * 10000).toFixed()),
                zdprice: (record?.[TABLE_CONFIG?.call_zdprice] * 10000).toFixed(),
                ccl: record?.[TABLE_CONFIG?.call_ccl],
                name: record?.[TABLE_CONFIG?.call_name],
                zdf: record?.[TABLE_CONFIG?.call_zdf],
                cjl: record?.[TABLE_CONFIG?.call_cjl],
                yhbdl: record?.[TABLE_CONFIG?.call_yhbdl],
            }
        }

        return {
            ...tem,
            isIncludeAname: tem.name.indexOf('A') !== -1
        }

    })
    return temlist
}
export const fomartDeatilData = (info) => {
    return {
        id: info?.f57,
        call_min: info?.f46,
        call_max: info?.f45
    }
}


export const formarPricelColor = (value, type) => {
    if (type === 'put') {
        if (value >= 1500 || value < 500) {
            return 'red'
        }

        if (value >= 500 || value < 1500) {
            return 'green'
        }

        if (value > 1000 && value < 2000) {
            return '#c76809'
        }

        return ''
    }
    if (value >= 1200 || value < 200) {
        return 'red'
    }
    if (value <= 500) {
        return '#d61c67'
    }
    if (value <= 800) {
        return 'green'
    }

    if (value > 800 && value < 1200) {
        return '#c76809'
    }

    return ''
}

export const formarCCLColor = (value) => {
    if (value >= 10000) {
        return {
            background: 'green',
            color: '#fff'
        }
    }
    if (value < 3000) {
        return {
            color: 'red'
        }
    }
    if (value < 4000) {
        return {
            color: '#d61c67'
        }
    }


    return {}
}